﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register" %>

<%@ Register Src="usercontrols/UniqueProduct.ascx" TagName="UniqueProduct" TagPrefix="uc1" %>
<%@ Register Src="usercontrols/NewsInDay.ascx" TagName="NewsInDay" TagPrefix="uc2" %>
<%@ Register Src="usercontrols/Servey.ascx" TagName="Servey" TagPrefix="uc3" %>
<%@ Register src="usercontrols/Search.ascx" tagname="Search" tagprefix="uc4" %>
<%@ Register src="usercontrols/SiteAds.ascx" tagname="SiteAds" tagprefix="uc5" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headMeta" runat="Server">
    <asp:Literal ID='lblMeta' runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="Server">
    <title>
        <asp:Literal ID='lblPageTitle' runat="server" /></title>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class='page_body page_width'>
        <div class="TimKiemSlideSiteAds">
            <uc4:Search ID="Search1" runat="server" />
            <div class="SlideShowBlock">
                <div id="wrapper">
                    <a href="http://dev7studios.com" id="dev7link" style="display: none;" title="">
                        </a>
                    <div class="slider-wrapper theme-default">
                        <div class="ribbon">
                        </div>
                        <div id="sliderlist" class="nivoSlider">
                        </div>
                    </div>
                </div>
                <script>

                    $(document).ready(function () {
                        createSlideShow(2, '#sliderlist', '');
                        $('#regWelcomeMessage').html(registerMessage);
                        $('#lang_RequireField').html(lang_RequireField);
                        $('#lang_regUserName').html(lang_regUserName);
                        $('#lang_regPass').html(lang_regPass);
                        $('#lang_regRetypePass').html(lang_regRetypePass);
                        $('#lang_regEmail').html(lang_regEmail);
                        $('#lang_regFirstName').html(lang_regFirstName);
                        $('#lang_regLastName').html(lang_regLastName);
                        $('#lang_regAddress').html(lang_regAddress);
                        $('#lang_regPhone').html(lang_regPhone);
                        $('#lang_regMobi').html(lang_regMobi);
                        $('#lang_regGender').html(lang_regGender);
                        $('#lang_regDateOfBirth').html(lang_regDateOfBirth);
                        $('#lang_regDay').html(lang_regDay);
                        $('#lang_regMonth').html(lang_regMonth);
                        $('#lang_regYear').html(lang_regYear);

                        $('#lang_regMale').html(lang_regMale);
                        $('#lang_regFemale').html(lang_regFemale);
                        $('#lang_regMonth').html(lang_regMonth);
                        $('#lang_regYear').html(lang_regYear);
                        $('#lang_regMonth').html(lang_regMonth);
                        $('#lang_regYear').html(lang_regYear);
                        $('#ctl00_ContentPlaceHolder1_btnReg').html(lang_registry);

                        

                    });
                </script>
            </div>
            <uc5:SiteAds ID="SiteAds1" runat="server" />
        </div>
        <div id="bodyHolder" class="DanhMucSanPhamList">
            <div id="CategoryMenu" class="LeftCatogory">
                <div class="DanhMucSanPhamHeader">
                    <a id='productcategory'></a>
                </div>
                <div id="leftPanel">
                </div>
                <uc1:UniqueProduct ID="UniqueProduct1" runat="server" />
                <uc2:NewsInDay ID="NewsInDay1" runat="server" />
                <uc3:Servey ID="Servey1" runat="server" />
            </div>
            <div class="KhuyenMaiHangMoiVe">
                <h1><asp:Literal ID='lblCateName' Text="Register" runat="server" /></h1>
                <div style="display: block; margin-left: 5px;">
                    <div class="clear" id="listItem" style="padding:10px;">
                        <div id="regWelcomeMessage"></div>
                        <style>
                            #regControl{width:650px; height:250px; display:block;}
                            #regControl label{height:20px; line-height:20px; width:215px; display:block; float:left; text-align:right; clear:both;margin-right:5px; color:#414042}
                            #regControl input{ border: 1px solid #808080; height: 18px; line-height: 18px; width: 370px; display: block; float: left; margin-top: 1px; margin-bottom: 1px; }
                            #lang_RequireField{font-weight:bold;color:#414042}
                            #regControl label b{color:Red;}
                            #regControl .rdo input{height:12px;width:auto; clear:none; margin: 4px 5px 4px 0; }
                            #regControl .rdo label{width:auto; clear:none;}
                            #regControl .date input{width:25px; height:14px; line-height:14px; margin-top:3px; clear:none; margin-right:3px; text-align:center; }
                            #regControl .date label{width:auto; clear:none;margin-right:5px;}
                            .regSubmit{margin-top: 5px;margin-bottom: 5px;float: right;height: 20px; width:100px; margin-right:-105px; line-height: 19px;display: block;background-color: #79AD36;position: relative;color: #F0F0F0;font-weight: bold;font-size: 11px;text-align: center;}
                            .error{color:Red; clear:both; float:left; padding:20px; text-align:center; width:620px; font-weight:bold;}
                        </style>
                        <div id='regControl'>
                            <label id="lang_RequireField"></label>
                            <label id='lang_regUserName' for='ctl00_ContentPlaceHolder1_regUserName'></label><input id="regUserName" runat='server' type="text" />
                            <label id='lang_regPass' for='ctl00_ContentPlaceHolder1_regPass'></label><input id="regPass" runat='server' type="text" />
                            <label id='lang_regRetypePass' for='ctl00_ContentPlaceHolder1_regRetypePass'></label><input id="regRetypePass" runat='server' type="text" />
                            <label id='lang_regEmail' for='ctl00_ContentPlaceHolder1_regEmail'></label><input id="regEmail" runat='server' type="text" />
                            <label id='lang_regFirstName' for='ctl00_ContentPlaceHolder1_regFirstName'></label><input id="regFirstName" runat='server' type="text" />
                            <label id='lang_regLastName' for='ctl00_ContentPlaceHolder1_regLastName'></label><input id="regLastName" runat='server' type="text" />
                            <label id='lang_regAddress' for='ctl00_ContentPlaceHolder1_regAddress'></label><input id="regAddress" runat='server' type="text" />
                            <label id='lang_regPhone' for='ctl00_ContentPlaceHolder1_regPhone'></label><input id="regPhone" runat='server' type="text" />
                            <label id='lang_regMobi' for='ctl00_ContentPlaceHolder1_regMobi'></label><input id="regMobi" runat='server' type="text" />
                            <label id='lang_regGender'></label>
                            <span class='rdo'>
                                <label id='lang_regMale' for='rdo1'></label>
                                <input id="rdo1" type="radio" name="gender" value="1" checked="True" runat="server" />
                                <label id='lang_regFemale' for='rdo2'></label>
                                <input id="rdo2" type="radio" name="gender" value="0" runat="server" />
                            </span>
                            <label id='lang_regDateOfBirth'></label>
                            <span class='date'>
                                <label id='lang_regDay' for='ctl00_ContentPlaceHolder1_regDay'></label>
                                <input id="regDay" runat='server' type="text" class='validateNum' maxlength="31" />
                                <label id='lang_regMonth' for='ctl00_ContentPlaceHolder1_regMonth'></label>
                                <input id="regMonth" runat='server' type="text" class='validateNum' maxlength="12" />
                                <label id='lang_regYear' for='ctl00_ContentPlaceHolder1_regYear'></label>
                                <input id="regYear" runat='server' type="text" class='validateNum' maxlength="2005" style='width:35px;' />
                            </span>
                            <label>
                            <asp:LinkButton ID="btnReg" CssClass='regSubmit' runat="server" 
                                onclientclick="return validateRegForm();" onclick="btnReg_Click">LinkButton</asp:LinkButton></label>
                                <script>
                                    function validateRegForm() {
                                        try {
                                            var message = "";
                                            var regYear = $('#ctl00_ContentPlaceHolder1_regYear').val();
                                            var regMonth = $('#ctl00_ContentPlaceHolder1_regMonth').val();
                                            var regDay = $('#ctl00_ContentPlaceHolder1_regDay').val();
                                            var regLastName = $('#ctl00_ContentPlaceHolder1_regLastName').val();
                                            var regFirstName = $('#ctl00_ContentPlaceHolder1_regFirstName').val();
                                            var mydate = new Date();
                                            mydate.setFullYear(regYear, regMonth - 1, regDay);

                                            if (!isValidDayOfBirth(regYear + '-' + regMonth + '-' + regDay)) {
                                                message = lang_regDateOfBirthNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regYear').focus();
                                            }
                                            else {
                                                $('#ctl00_ContentPlaceHolder1_regYear').val(jQuery.datepicker.parseDate("yy-mm-dd", regYear + '-' + regMonth + '-' + regDay, null).getFullYear());
                                            }
                                            if (isNullOrEmpty(regLastName) || isNullOrEmpty(regFirstName)) {
                                                message = lang_regNameNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regLastName').focus();
                                            }
                                            if (!isValidEmailAddress($('#ctl00_ContentPlaceHolder1_regEmail').val())) {
                                                message = lang_regEmailNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regEmail').focus();
                                            }
                                            if ($('#ctl00_ContentPlaceHolder1_regRetypePass').val() != $('#ctl00_ContentPlaceHolder1_regPass').val()) {
                                                message = lang_regRetypePassNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regRetypePass').focus();
                                            }
                                            if (isNullOrEmpty($('#ctl00_ContentPlaceHolder1_regPass').val())) {
                                                message = lang_regPassNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regPass').focus();
                                            }
                                            if (isNullOrEmpty($('#ctl00_ContentPlaceHolder1_regUserName').val())) {
                                                message = lang_regUserNameNotValid + "\n" + message;
                                                $('#ctl00_ContentPlaceHolder1_regUserName').focus();
                                            }
                                            if (message != "") {
                                                $('#ctl00_ContentPlaceHolder1_lblMessage').html(message.replace(/\n/gi, "<br />"));
                                                alert(message);
                                                return false;
                                            }
                                            else {
                                                $('#ctl00_ContentPlaceHolder1_lblMessage').html('');
                                                return true;
                                            }
                                        } catch (e) {
                                            alert(e.Message)
                                            return false;
                                        }
                                    }
                                    $('#ctl00_ContentPlaceHolder1_regUserName').blur(function () {
                                        var purl = domain + 'usercontrols/Webkit.aspx/CheckAvailbleUserName';
                                        var pdata = "{ 'UserName': '" + $('#ctl00_ContentPlaceHolder1_regUserName').val() + "'}";
                                        $.ajax({
                                            type: "POST",
                                            url: purl,
                                            data: pdata,
                                            contentType: "application/json; charset=utf-8",
                                            dataType: "json",
                                            success: function (result) {
                                                var data = result.d;
                                                if (data != 'OK') {
                                                    alert(lang_regUserNameInUse);
                                                }
                                            }
                                        });
                                    });
                                    $('#ctl00_ContentPlaceHolder1_regEmail').blur(function () {
                                        var purl = domain + 'usercontrols/Webkit.aspx/CheckAvailbleEmail';
                                        var pdata = "{ 'Email': '" + $('#ctl00_ContentPlaceHolder1_regEmail').val() + "'}";
                                        $.ajax({
                                            type: "POST",
                                            url: purl,
                                            data: pdata,
                                            contentType: "application/json; charset=utf-8",
                                            dataType: "json",
                                            success: function (result) {
                                                var data = result.d;
                                                if (data != 'OK') {
                                                    alert(lang_regUserEmailInUse);
                                                }
                                            }
                                        });
                                    });
                                </script>
                                
                            <label ></label> <span class='rdo error' runat="server" id='lblMessage'></span>
                        </div>
                    </div>
                    <asp:Literal id='ltrInitScript' runat="server" />
                    <input style='display:none;' class="gotoPage validateNum" id='txtGoToPage' type="text" maxlength="0" />
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
</asp:Content>

